1. Field of the Invention
The present invention generally relates to performing calculations in a processor.
2. Description of the Related Art
The calculation of a floating point weighted average is required by many different hardware and software applications. One such application is full screen antialiasing (FSAA). Full screen antialiasing reduces the “jaggy” appearance of images where a lower than ideal screen resolution is used. There are also many other instances where a weighted average function is needed in computer graphics, such as triangle setup, or averaging the different components of phong lighting.
In existing floating point units such as those implementing the VMX instruction set or PowerPC scalar floating point instructions, computing a weighted average between the values involves several instructions with dependencies between them that stall the pipeline and can introduce performance problems. In addition, a number of temporary registers are consumed in the process. In certain implementations of vector floating point pipes that contain a dot product instruction such as the processor core used in the Xbox 360, implementing a weighted average function may be easier but still takes many cycles and consumes temporary registers in the process.
Accordingly, what is needed are an improved method, computer-readable medium, and apparatus for implementing a floating point weighted average function in a manner that is more efficient relative to prior art approaches.